﻿using System;

namespace Com.Lancetinc.Evs.Reports.RadPdf;

internal class DisposableOpacity : IDisposable
{
    private PdfRenderContext context;
    private readonly double opacity;

    internal DisposableOpacity(PdfRenderContext context)
    {
        this.context = context;
        opacity = context.opacity;
    }

    public void Dispose()
    {
        if (context != null)
        {
            context.opacity = opacity;
            context = null;
        }
    }
}